home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
TCL1
/
CDICTION
/
TAOUTILS.C
< prev
next >
Wrap
Text File
|
1989-09-15
|
3KB
|
93 lines
#include "TaoUtils.h"
#include "CBartender.h"
#include "CError.h"
#include "TBUtilities.h"
#include "ColorToolbox.h"
#define kPreferredFontStr 1002 /* 'STR ' ID for preferred font family */
extern CBartender *gBartender;
extern CError *gError;
/*****************************************************************************/
void SetCmdEnable( Int32 cmd,Int16 flag)
{
if (flag)
gBartender->EnableCmd( cmd);
else gBartender->DisableCmd( cmd);
} /* SetCmdEnable */
/*****************************************************************************/
void GetPreferredFontName( StringPtr fontName)
{
StringHandle s;
s = GetString( kPreferredFontStr);
if (s)
{
CopyPString( *s, fontName);
HPurge( s);
}
else GetFontName(1, fontName);
} /* GetPreferredFontName */
/*****************************************************************************/
Int16 GetPreferredFontNum( void)
{
Int16 num;
Str255 name;
GetPreferredFontName( name);
GetFontNumber( name, &num);
return num;
} /* GetPreferredFontNum */
/*****************************************************************************/
void myDrawSICN( Int16 SICNid, Int16 index, Point location, Int16 mode)
{
Handle theSICN;
BitMap theImage;
Rect theBounds;
theSICN = GetResource('SICN', SICNid);
CheckResource(theSICN);
HLock(theSICN);
/* A SICN resource is really a list */
/* of small icons, each of which */
/* has 32 bytes of data */
/* 16 x 16 = 256 bits = 32 bytes */
/* Create a bitmap so we can copy */
/* the SICN image on the screen */
/* Index into handle to get a ptr */
/* to the SICN bit image */
theImage.baseAddr = *theSICN + (index - 1) * 32;
theImage.rowBytes = 2; /* 16 bits is 2 bytes */
/* Place bitmap at desired locaton */
SetRect(&theBounds, location.h, location.v,
location.h + 16, location.v + 16);
theImage.bounds = theBounds;
/* Copy image on to the screen */
CopyBits(&theImage, &thePort->portBits,
&theBounds, &theBounds, mode, NIL);
HUnlock(theSICN);
}
/*****************************************************************************/
Boolean IsDeepPort( void)
/*
return true if thePort has bit depth > 1
*/
{
if (((CGrafPtr)thePort)->portVersion < 0) /* is it a color grafport? */
return ((**((CGrafPtr)thePort)->portPixMap).pixelSize > 1);
else
return FALSE;
} /* IsDeepPort */
/*****************************************************************************/